Skip to content

[scheduler] Add sqlx warnings as sentry events#2250

Merged
DiegoTavares merged 1 commit intoAcademySoftwareFoundation:masterfrom
DiegoTavares:sentry_sqlx
Apr 7, 2026
Merged

[scheduler] Add sqlx warnings as sentry events#2250
DiegoTavares merged 1 commit intoAcademySoftwareFoundation:masterfrom
DiegoTavares:sentry_sqlx

Conversation

@DiegoTavares
Copy link
Copy Markdown
Collaborator

@DiegoTavares DiegoTavares commented Apr 7, 2026

Related Issues

sqlx warnings should be tracked by sentry

Summarize your change.

Treat sentry sqlx warnings as events

Summary by CodeRabbit

  • Chores
    • Enhanced error monitoring with improved categorization of logs and errors to better distinguish critical issues from routine entries, resulting in more effective incident detection and troubleshooting.

@DiegoTavares DiegoTavares marked this pull request as ready for review April 7, 2026 18:58
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

The Sentry tracing integration in the scheduler's main entry point is updated from an unfiltered default layer to a customized layer with an event_filter. This filter categorizes logs as Sentry events or breadcrumbs based on their target and severity level.

Changes

Cohort / File(s) Summary
Sentry Tracing Configuration
rust/crates/scheduler/src/main.rs
Replaced default tracing layer with a custom layer featuring an event_filter that routes SQLx warnings and all errors/higher-severity logs to Sentry events, while downgrading other records to breadcrumbs.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • lithorus
  • ramonfigueiredo

Poem

🐰 Hop through logs with care and grace,
Sort the wheat from breadcrumb base,
SQLx warns, errors shine so bright,
Sentry events gleam in the night!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title '[scheduler] Add sqlx warnings as sentry events' directly matches the main change: configuring Sentry tracing to treat sqlx warnings as events rather than breadcrumbs.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
rust/crates/scheduler/src/main.rs (1)

296-305: Logic is correct and achieves the PR objective.

The event filter correctly routes:

  • sqlx WARN → Sentry Event
  • Any ERROR → Sentry Event
  • Everything else → Breadcrumb

This integrates well with the EnvFilter config (info,sqlx=warn) which ensures sqlx WARN messages reach this layer.

Minor style nit: There's an inconsistency in level comparisons—line 298 uses *metadata.level() (dereferenced) while line 299 uses metadata.level() (reference). Both work, but unifying them would improve readability.

,

Optional: unify comparison style
     let sentry_layer = sentry::integrations::tracing::layer().event_filter(|metadata| {
         // Register sqlx WARN messages as Sentry issues (events) instead of breadcrumbs
-        if (metadata.target().starts_with("sqlx") && *metadata.level() == tracing::Level::WARN)
-            || metadata.level() <= &tracing::Level::ERROR
+        if (metadata.target().starts_with("sqlx") && *metadata.level() == tracing::Level::WARN)
+            || *metadata.level() <= tracing::Level::ERROR
         {
             sentry::integrations::tracing::EventFilter::Event
         } else {
             sentry::integrations::tracing::EventFilter::Breadcrumb
         }
     });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rust/crates/scheduler/src/main.rs` around lines 296 - 305, The sentry_layer
event_filter mixes dereferenced and referenced level comparisons; make them
consistent by using the same form for both comparisons (e.g., dereference
metadata.level() in both places or compare references in both places). Update
the closure in sentry::integrations::tracing::layer().event_filter so the checks
use the same style (referencing the symbol sentry_layer and the closure's
metadata.level(), and comparing against tracing::Level::WARN and
tracing::Level::ERROR consistently) to improve readability.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@rust/crates/scheduler/src/main.rs`:
- Around line 296-305: The sentry_layer event_filter mixes dereferenced and
referenced level comparisons; make them consistent by using the same form for
both comparisons (e.g., dereference metadata.level() in both places or compare
references in both places). Update the closure in
sentry::integrations::tracing::layer().event_filter so the checks use the same
style (referencing the symbol sentry_layer and the closure's metadata.level(),
and comparing against tracing::Level::WARN and tracing::Level::ERROR
consistently) to improve readability.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 58e626c3-5c27-4842-bd2e-6f141c529b6e

📥 Commits

Reviewing files that changed from the base of the PR and between 86b9164 and 57dcfe4.

📒 Files selected for processing (1)
  • rust/crates/scheduler/src/main.rs

@DiegoTavares DiegoTavares merged commit cc5c264 into AcademySoftwareFoundation:master Apr 7, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant